<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-bean" prefix="bean"%>
<%@ taglib uri="/struts-html" prefix="html"%>
<%@ taglib uri="/struts-logic" prefix="logic"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>基本资料页面</title>
	</head>
	<script type="text/javascript" src="/js/prototype-1.5.1.2.js"
		charset="UTF-8"></script>
	<script language="javascript">
<bean:write name="com_struts_web_user_register_FavoriteForm" property="printVocSql" filter="false"/>
<bean:write name="com_struts_web_user_register_FavoriteForm" property="printStaSql" filter="false"/>
<bean:write name="com_struts_web_user_register_FavoriteForm" property="printAddSql" filter="false"/>

//处理提交信息
function doMethod(){
  
   if(document.all.ssubstation.length<1 || document.all.splaceList.length<1 || document.all.monthlyPay=="" || document.all.monthlyPay.length<1){
      alert("带星号的为必填项！");
      return false;
   }else{
   
    if(document.all.interview.checked){
    document.all.interview.value=1;
    }else{document.all.interview.value=0;}
    
    if(document.all.containEat.checked){
    document.all.containEat.value=1;
    }else{document.all.containEat.value=0;}
    
    if(document.all.containLodging.checked){
    document.all.containLodging.value=1;
    }else{document.all.containLodging.value=0;}
    
       document.all.vocationList.value="";
       document.all.stationList.value="";
       document.all.placeList.value="";
       //职业信息
      for(var i=0;i<document.all.svocationList.length;i++){
      document.all.vocationList.value=document.all.vocationList.value + document.all.svocationList.options[i].value + ",";
      }
      
      //岗位信息
      for(var i=0;i<document.all.ssubstation.length;i++){
      document.all.stationList.value=document.all.stationList.value + document.all.ssubstation.options[i].value + ",";
      }
      
      //地区信息
      for(var i=0;i<document.all.splaceList.length;i++){
      document.all.placeList.value=document.all.placeList.value + document.all.splaceList.options[i].value + ",";
      }
      
      document.all.omethod.value="add";
      document.forms[0].submit();
      document.all.omethod.value="";
     }
   
   }
    
//处理列表信息
function Left2Right(left,right,maxItem,allowRepeat,superaddition){

if(!allowRepeat)allowRepeat = false;
	if(!superaddition)superaddition = "";
	if(!left || !right || left.tagName!='SELECT' || left.tagName!='SELECT') return false;
	if(!maxItem || isNaN(maxItem) || maxItem<0)maxItem=0;
	if(maxItem>0 && right.options.length>=maxItem)
	{
		alert("不能超过" + maxItem + "项!");
		return;
	}
	for(var i=0; i<left.options.length;i++)
	{
		if(left.options[i].selected)
		{
			if(!allowRepeat && findItem(right,left.options[i].text,left.options[i].value,1)!=null)
				alert("\"" + left.options[i].text + "\"" + "已经存在,不能重复添加!");
			else{
				if(superaddition=="")
					right.options.add(new Option(left.options[i].text,left.options[i].value));
				else
					right.options.add(new Option(superaddition + "－" + left.options[i].text,left.options[i].value));
					
				}
		}
	}

}

//处理列表信息
function deloption(right){
   for(var i=0;i<right.options.length;i++){
     if(right.options[i].selected){
       right.options.remove(i);
     }
   }
}

function findItem(target,text,value,flag)
{
	if(!flag) flag = 0;
	if(!target || target.tagName!='SELECT') return null;
	for(var i=0;i<target.options.length;i++)
	{
		if(flag==1 && target.options[i].value==value) return target.options[i];
		if(flag==2 && target.options[i].text==text) return target.options[i];
		if(target.options[i].text==text&&target.options[i].value==value) return target.options[i];
	}
	return null;
}
var chosen_sort=0;
function doSubstation() {
chosen_sort = document.all.stationSort.selectedIndex;
if(chosen_sort==0 && document.all.substation.options.length>0){
   document.all.substation.options.length=0;
}else{
document.all.stationSort.blur();
document.all.substation.options.length = 0 ;
for (var i = 0 ; i < substation [chosen_sort].length ; i++){
var value=substation[chosen_sort][i];
var label=substation[chosen_sort][++i]
document.all.substation.options [i/2] = new Option(label,value);
  }
}
}
</script>
	<body>
		<html:form action="/com/struts/web/user/register/regfavorite"
			method="post">
			<html:hidden property="omethod" />
			<html:hidden property="stationList" />
			<html:hidden property="vocationList" />
			<html:hidden property="placeList" />
			<table>
				<tr>
					<td>
						<table border="1" width="100%">
							<tr>
								<td>
									意向行业
								</td>
							</tr>
							<tr>
								<td>
									<select id="vocationSource" size="4" style="width:200">
										<script language="JavaScript">
			        for (var i = 0; i < (vocation.length); i++) {
			         document.write("<OPTION value='"+vocation[i]+"'");
			    document.write(">" + vocation[++i]+"</OPTION>");	
			  }
  </script>
									</select>
								</td>
								<td width="60">
									<input type="button" value="》" id="vl2r"
										onclick="Left2Right(document.all.vocationSource,document.all.svocationList,3,0)" />
									<input type="button" value="《" id="vd"
										onclick="deloption(document.all.vocationList)" />
								</td>
								<td>
									<select id="svocationList" size="4" style="width:200"></select>

								</td>
							</tr>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table border="1" width="100%">
							<tr>
								<td>
									*意向岗位
								</td>
							</tr>
							<tr>
								<td>
									<select id="stationSort" style="width:200"
										onchange="doSubstation()">
										<SCRIPT language="JavaScript">
			        for (var i = 0; i < (station.length); i++) {
			         document.write("<OPTION value='"+station[i]+"'");
			    document.write(">" + station[++i]+"</OPTION>");	
			  }
			</SCRIPT>
									</select>
								</td>
								<td rowspan="2">
									<input type="button" value="》" id="sr2l"
										onclick="Left2Right(document.all.substation,document.all.ssubstation,3,0,document.all.stationSort.options[document.all.stationSort.selectedIndex].text)" />
									<input type="button" value="《" id="sd"
										onclick="deloption(document.all.ssubstation)" />
								</td>
								<td rowspan="2">
									<select id="ssubstation" size="4" style="width:200">

									</select>

								</td>
							</tr>
							<tr>
								<td>
									<select id="substation" size="4" style="width:200"></select>
								</td>
							</tr>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table border="1" width="100%">
							<tr>
								<td>
									*意向地区
								</td>
							</tr>
							<tr>
								<td>
									<select id="saddress" size="4" style="width:200">
										<SCRIPT language="JavaScript">
			        for (var i = 0; i < (address.length); i++) {
			         document.write("<OPTION value='"+address[i]+"'");
			    document.write(">" + address[++i]+"</OPTION>");	
			  }
			</SCRIPT>
									</select>
								</td>
								<td>
									<input type="button" value="》" id="ar2l"
										onclick="Left2Right(document.all.saddress,document.all.splaceList,3,0)" />
									<input type="button" value="《" id="ad"
										onclick="deloption(document.all.splaceList)" />
								</td>
								<td>
									<select id="splaceList" size="4" style="width:200">

									</select>

								</td>
							</tr>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table border="1" width="100%">
							<tr>
								<td>
									*求职类型：
								</td>
								<td>
									<html:select property="jobType">
										<option value="0">
											全职
										</option>
										<option value="1">
											兼职
										</option>
										<option value="2">
											临时工
										</option>
										<option value="3">
											合同工
										</option>
									</html:select>
								</td>
							</tr>
							<tr>
								<td>
									*期望薪资：
								</td>
								<td>
									月薪
									<html:text property="monthlyPay" />
									RMB以上
									<html:checkbox property="interview" />
									可面议
									<html:checkbox property="containEat" />
									包吃
									<html:checkbox property="containLodging" />
									包住
								</td>
							</tr>
							<tr>
								<td>
									*到岗时间：
								</td>
								<td>
									<html:select property="arriveTime">
										<option value="0">
											随时到岗
										</option>
										<option value="1">
											一周内
										</option>
										<option value="2">
											二周内
										</option>
										<option value="3">
											一个月内
										</option>
										<option value="4">
											两个月内
										</option>
										<option value="5">
											三个月内
										</option>
										<option value="6">
											面议
										</option>
									</html:select>
								</td>
							</tr>
							<tr>
								<td>
									其它要求：
								</td>
								<td>
									<html:textarea property="otherRequire"></html:textarea>
								</td>
							</tr>
						</table>
					</td>
				</tr>

				<tr>
					<td>
						<table border="1" width="100%">
							<tr>
								<td>
									<input type="button" value="保存－>下一步" onclick="doMethod()" />
									<input type="reset" value="重置" />
								</td>
							</tr>
						</table>
					</td>
				</tr>

			</table>
		</html:form>

	</body>
</html>
